package com.attendance.model.Result;

import com.attendance.model.Employee;
import com.github.pagehelper.PageInfo;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;

/**
 * Created by inuyasha on 2016/11/29.
 */
public class Response extends HashMap implements Serializable {
    private static final long serialVersionUID = -645660450630516270L;

    public Response() {
        this(true, ResultCode.SUCCESS);
    }

    public Response(ResultCode resultCode) {
        this(resultCode == ResultCode.SUCCESS, resultCode);
    }

    public Response(boolean success, ResultCode resultCode) {
        this.put("success", success);
        this.put("resultCode", resultCode);
        this.put("message", resultCode.getMessage());
    }

    public void putResult(List list){
        PageInfo pageInfo = new PageInfo(list);
        this.put("result",pageInfo);
    }

    public void putCurrent(Employee employee){
        this.put("user",employee);
    }
}
